/*
 * event
 */
E.event = {
    treeCurrentOptions : -1,
    treeWin : null
};

/**
 * treeCilckCallback
 */
E.event.treeCilckCallback = function(view, record, item, index, e) {

    if ("treeroot" == record.data.id) {
        return;
    } else if ("src1" == record.data.id && E.event.treeCurrentOptions != 1) {
        E.event.treeCurrentOptions = 1;
        Ext.removeNode(Ext.get("center-div"));
        Ext.get('viewport_center').setHTML('<div id="center-div"></div>');
        E.grid.load();
    }

};

E.event.gridClick = function(view, record, item, index, e) {

    var table = "<div id='gridDiv'><table border='2' width='100%'>";
    table += "<tr><td width='30%'>date</td><td width='70%'><input type='text' size='55' value='"
            + record.data.date + "' /></td></tr>";
    table += "<tr><td width='30%'>price</td><td width='70%'><input type='text' size='55' value='"
            + record.data.price + "' /></td></tr>";
    table += "<tr><td width='30%'>description</td><td width='70%'><input type='text' size='55' value='"
            + record.data.description + "' /></td></tr>";
    table += "</table></div>";

    var _win = E.event.treeWin = Ext.create('Ext.window.Window', {
        title : 'Edit',
        height : 200,
        width : 600,
        layout : 'fit',
        id : '_win12',
        items : E.grid.form(record.data),
        modal : true
    });

    _win.show();
};